<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Button test</title>
<link rel="stylesheet" type="text/css" href="../button/button.css" />
<link rel="stylesheet" type="text/css" href="../popbox/popbox.css" />
<link rel="stylesheet" type="text/css" href="../toolbar/toolbar.css" />
<link rel="stylesheet" type="text/css" href="popmenu.css" />
<link rel="stylesheet" type="text/css" href="test.css" />

<script type="text/javascript" src="../../os3jslib/liwe.js"></script>
<script type="text/javascript" src="../../os3jslib/utils.js"></script>
<script type="text/javascript" src="../../os3jslib/dom.js"></script>
<script type="text/javascript" src="../../os3jslib/string_enh.js"></script>
<script type="text/javascript" src="../wwl.js"></script>

<script type="text/javascript" src="../button/button.js"></script>
<script type="text/javascript" src="../popbox/popbox.js"></script>
<script type="text/javascript" src="../toolbar/toolbar.js"></script>
<script type="text/javascript" src="popmenu.js"></script>

<script type="text/javascript">
function init ()
{
	var m = new WWL.popmenu ( 'prova' );

	m.add_item ( { txt: 'ciao' } );
	m.add_item ( { txt: 'john' } );
	m.add_item ( { txt: 'fabio', cback: hello, block_auto_close: true } );

	m.set_parent ( $( 'p1' ), 'D' );
}

function hello ( widget, name, div )
{
	var m = new WWL.popmenu ( 'sub' );
	m.add_item ( { txt: 'sub1' }) ;
	m.add_item ( { txt: 'sub2' } );
	m.add_item ( { txt: 'sub3' } );

	m.box.set_parent ( div, 'R' );
	
	m.show ();
}

function hide_show (div)
{
	var m = WWL.popmenu.get_instance ( 'prova' );

	m.set_parent ( div );
	m.show_hide ();
}
</script>
</head>
<body onload="init()">
<div id="p1" onclick="hide_show(this)">cioa</div>

<div id="p2" onclick="hide_show(this)" style="position: absolute; top: 35px; left: 200px; width: 200px; height: 200px; border: 1px solid black">pizza</div>

</body>
</html>
